<?php
class Controller
{
    static $controller;
    protected $_at;
    
    private function __construct() {
    }

    /**
     *
     * @return Controller
     */
    static function getInstance()
    {
        if (is_null(self::$controller) ){
            echo "<br>first controller creation";
            self::$controller = new Controller();
        }
        return self::$controller;
    }

    /**
     *
     * @return Smarty
     */
    public function at()
    {
        
        if (!$this->_at) {
            $this->_at = new Smarty();
            $this->_at->setTemplateDir($documentRoot . 'templates');
            $this->_at->setCompileDir($documentRoot . 'templates_c');
            $this->_at->setCacheDir($documentRoot . 'smarty/cache');
            $this->_at->setConfigDir($documentRoot . 'smarty/configs');
        }
        return $this->_at;
    }
}
